package com.patterns.mediator.SaleComputer;

/**
 * Created by Xiao Yiyun on 2017/4/29.
 * 修改后的库存管理
 */
public class Stock extends AbstractColleague {
    public Stock(AbstractMediator mediator) {
        super(mediator);
    }
    //刚开始有100台电脑
    private static int COMPUTER_NUMBER = 100;
    //库存增加
    public void increase(int number) {
        COMPUTER_NUMBER = COMPUTER_NUMBER + number;
        System.out.println("库存量为" + COMPUTER_NUMBER);
    }
    //库存降低
    public void decrease(int number) {
        COMPUTER_NUMBER = COMPUTER_NUMBER - number;
        System.out.println("库存量为" + COMPUTER_NUMBER);
    }
    //获取库存数量
    public int getStockNumber() {
        return COMPUTER_NUMBER;
    }
    //清理存货
    public void clearStock() {
        System.out.println("清理存货数量为" + COMPUTER_NUMBER);
        super.mediator.execute("stock.clear");
    }
}
